// ----------------------------------------------------------------------------
// WinMain
//
// ----------------------------------------------------------------------------


#include "Tigerengine.h"


/* --------------------------------------------------------
 * WinMain()
 *		Entry point for the game.
 * ----------------------------------------------------- */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine, int nCmdShow)
{
	MSG			msg;
	CApp	*App = new CApp();

	// Initialize the game environment
	App->Init();

	// Start the gameloop
	while(App->IsRunning())
	{
		// Check for windows messages
		if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			DispatchMessage(&msg);
			TranslateMessage(&msg);
		} // if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		else {
			if(App->m_input->GetKeyStatus(VK_ESCAPE))
			{
				// Time to quit program
				App->Shutdown();
				break;
			}

			App->Gameloop();
		}
		
	} // while(App->IsRunning())
	
	return TRUE;
} // int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)